The former cannot. The best you can do right now is integrate a power pole into your compound entity and forbid placing power poles such that their connection area overlaps with the entity, or use linked connections to put all the energy source stuff on another surface. (which doesn't work if one of the components needs to be at the location of the compound entity... such as, say, a lightning rod)
So I propose the creation of a linked energy source type that functions as an electric energy source that only connects via control-stage script. This energy source would be available for prototypes anywhere an electric energy source is available. (maybe it should be a runtime thing or a property of electric energy sources?) For a full list, in case others are unaware, you can look at the api reference for ElectricEnergySources.
This would enable many things that aren't currently feasible without Lua scripting, hopefully in a less intrusive manner than, for example, adding fluid energy sources to entities that can only use void or electric energy inputs, or adding optional fluid/heat outputs to generator prototypes that don't already support them.