[BUGFIX] RTE: Empty paragraphs are not correctly transformed

Problem: Empty paragraphs entered in the RTE may get lost on way to
database if no block is found in content, as well as on way to the RTE
if followed by a block.
Solution: Fix both transformations and add multiple unit test cases.

Change-Id: I6c5495fb668f29267bcdeb7b44814a4bb9dc0f96
Releases: 4.5, 4.7, 6.0, 6.1
Resolves: #36904
Reviewed-on: https://review.typo3.org/18800
Reviewed-by: Stanislas Rolland
Tested-by: Stanislas Rolland